local skel = fk.CreateSkill {
  name = "rmt__leishi",
}

Fk:loadTranslationTable{
  ["rmt__leishi"] = "诔世",
  [":rmt__leishi"] = "当你摸牌时，若此次摸牌数：为2，你须放弃此次摸牌，改为回复1点体力；不为2，你可以回复1点体力。",

  ["#rmt__leishi-recover"] = "诔世：你可以回复1点体力",

  ["$rmt__leishi1"] = "日往哀深、岁暮思繁，灼灼遐清几曾有？",
  ["$rmt__leishi2"] = "列宿皎皎、星稀月明，紫薇晖焕又照我。",
}

skel:addEffect(fk.BeforeDrawCard, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and (data.num == 2 or player:isWounded())
  end,
  on_cost = function (self, event, target, player, data)
    if data.num == 2 then
      return true
    else
      return player.room:askToSkillInvoke(player, { skill_name = skel.name, prompt = "#rmt__leishi-recover" })
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:recover({
      who = player,
      num = 1,
      recoverBy = player,
      skillName = skel.name,
    })
    if data.num == 2 then
      data.num = 0
    end
  end,
})

return skel
